<!--
 * @Description: 订单列表搜索信息
 * @Version: 1.0
 * @Author: Yuanjy
 * @Date: 2020-03-31 12:04:35
 * @LastEditors: Yuanjy
 * @LastEditTime: 2020-04-22 18:04:39
 -->
<template>
  <div class="head-container">
    <!-- 搜索  -->
    <el-select v-model="query.principal" size="small" filterable placeholder="选择营养师" style="width: 200px;" class="filter-item">
      <el-option v-for="item in principals" :key="item.id" :label="item.name" :value="item.id" />
    </el-select>
    <el-input v-model="query.id" clearable placeholder="订单ID" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
    <el-input v-model="query.delivery_name" clearable placeholder="输入姓名" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
    <el-input v-model="query.nick_name" clearable placeholder="输入昵称" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
    <el-input v-model="query.phone" clearable placeholder="输入手机号码" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
    <el-button class="filter-item" size="mini" type="primary" icon="el-icon-search" @click="toQuery">搜索</el-button>
    <!-- 新增  -->
    <div style="display: inline-block;margin: 0px 2px;">
      <el-button
        class="filter-item"
        size="mini"
        type="primary"
        icon="el-icon-plus"
        @click="$refs.form.dialog = true">新增</el-button>
      <eForm ref="form" :is-add="true" :types="sup_this.types" :second-channels="sup_this.secondChannels" />
    </div>
  </div>
</template>

<script>
import eForm from './form'

export default {
  components: { eForm },
  props: {
    query: {
      type: Object,
      required: true
    },
    sup_this: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      principals: []
    }
  },
  mounted() {
    this.initParam()
  },
  methods: {
    initParam() {
      //获取当前管理员的部门成员信息
      this.$api.permission.user
        .getSubordinate()
        .then(res => {
          this.principals = res.data
        }).catch(err => {
          console.log(err)
        })
    },
    toQuery() {
      this.$parent.page = 0
      this.$parent.init()
    }
  }
}
</script>
